-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ValidatorStore interface doesn't match StakingKeeper #17164
Conversation
This comment has been minimized.
This comment has been minimized.
We could just have a function call in /integration/ to, it does not pollute simapp. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update the ADR as well
GetValidatorByConsAddr(sdk.Context, cryptotypes.Address) (cryptotypes.PubKey, error) |
Moving this to draft as I'm writing an integration test |
can we import baseapp for now into staking to make sure it matches, later on we can fix the dependency but for now i think its fine |
I wanted to avoid this if possible honestly. I think we tweak the API(s) to avoid this but if we cannot, then yes, this is a fallback |
@tac0turtle @alexanderbez I just saw your comments, in my last commit I've added the necessary APIs to the staking keeper + an integration test. lmk what you think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
baseapp/abci_utils.go
Outdated
@@ -125,12 +107,20 @@ func ValidateVoteExtensions( | |||
return fmt.Errorf("failed to verify validator %X vote extension signature", valConsAddr) | |||
} | |||
|
|||
sumVP = sumVP.Add(validator.BondedTokens()) | |||
bondedTokens, err := valStore.BondedTokensByConsAddr(ctx, valConsAddr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, isn't it slower now because we get the validator twice? While before only once.
It is probably negligible but just curious. :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it will be slower sadly. We could have a specific API that returns both bonded tokens and public key, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objection to that personally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@facundomedica yes let's do that. This will be used in the VE hotpath so we don't want obvious performance slowdowns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added BondedTokensAndPubKeyByConsAddr
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> (cherry picked from commit c3ae0b0) # Conflicts: # CHANGELOG.md
Description
Closes: #17163
We had to add the necessary functions directly to the Staking Keeper given that when you have an interface with a function that returns another interface, you can't make another interface comply because the returning interface won't be accepted (example: https://go.dev/play/p/tz50jVl0NBw).
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
make lint
andmake test
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change